
**REPLICATION CODE FOR
**Protecting Workers Abroad and Industries at Home:
**Rights-Based Conditionality in Trade Preference Programs
**Emilie Hafner-Burton, Layna Mosley and Robert Galantucci
**Journal of Conflict Resolution 2018

**NOTE 
**THE CODE BELOW FOR TABLES 1, B, C, D, E, F, G, H, I, and J
**RELIES ON THE DATABASE TITLED "GSP bilateral data 5.9.18"

**THE CODE BELOW FOR TABLES 2, K, and L
**RELIES ON THE DATABASE TITLED "GSP CNL data 5.9.18"


**creates the ordered DV, "All Sanctions" for Tables 1, C and J
gen  actions_O=0
replace actions_O = 1 if sanc_review==1
replace actions_O = 2 if sanc_suspend==1
tab actions_O


**TABLE 1
  
logit sanc_review cirilagn importcompetingimptslog  unemploymentlagged unipdiff pres_party dem_cong gdppcllog_full pop_full_log if  year > 1984 &   currentbeneficiary== 1, cluster(ccode)
eststo m1
logit sanc_suspend cirilagn importcompetingimptslog  unemploymentlagged unipdiff pres_party dem_cong gdppcllog_full pop_full_log if  year > 1984 &   potentialbeneficiary== 1, cluster(ccode)
eststo m2
ologit actions_O cirilagn importcompetingimptslog  unemploymentlagged unipdiff pres_party dem_cong gdppcllog_full pop_full_log if  year > 1984 &   potentialbeneficiary== 1, cluster(ccode)
eststo m3
estout m1 m2 m3, cells(b(star fmt(3)) se(par fmt(2))) style(tex) starlevels(* 0.10 ** 0.05 *** .01)



**TABLE 2  

reg  cnl_quant_log cirilagn importcompetingimptslog unemploymentlagged gdppcllog_full pop_full_log unipdiff if potentialbeneficiary == 1 & ldbc == 0, cluster(ccode)
eststo m1
fitstat
nbreg  tarifflinesineligible cirilagn importcompetingimptslog unemploymentlagged gdppcllog_full pop_full_log unipdiff if potentialbeneficiary == 1 & ldbc == 0, cluster(ccode)
eststo m2
fitstat
reg  cnl_quant_log cirilagn totalimportslog unemploymentlagged gdppcllog_full pop_full_log unipdiff if potentialbeneficiary == 1 & ldbc == 0, cluster(ccode)
eststo m3
fitstat
nbreg  tarifflinesineligible cirilagn totalimportslog unemploymentlagged gdppcllog_full pop_full_log unipdiff if potentialbeneficiary == 1 & ldbc == 0, cluster(ccode)
eststo m4
fitstat
estout m1 m2 m3 m4, cells(b(star fmt(3)) se(par fmt(2))) style(tex) starlevels(* 0.10 ** 0.05 *** .01)



***** ONLINE APPENDIX MATERIALS *****

**Table B (Rare Events)
relogit sanc_review cirilagn importcompetingimptslog  unemploymentlagged unipdiff pres_party dem_cong gdppcllog_full pop_full_log if  year > 1984 &   currentbeneficiary== 1, cluster(ccode)
eststo m1
relogit sanc_suspend cirilagn importcompetingimptslog  unemploymentlagged unipdiff pres_party dem_cong gdppcllog_full pop_full_log if  year > 1984 &   potentialbeneficiary== 1, cluster(ccode)
eststo m2
estout m1 m2, cells(b(star fmt(3)) se(par fmt(2))) style(tex) starlevels(* 0.10 ** 0.05 *** .01)


**TABLE C (alternate import variable)

logit sanc_review cirilagn totalimportslog  unemploymentlagged unipdiff pres_party dem_cong gdppcllog_full pop_full_log if  year > 1984 &   currentbeneficiary== 1, cluster(ccode)
eststo m1
logit sanc_suspend cirilagn totalimportslog  unemploymentlagged unipdiff pres_party dem_cong gdppcllog_full pop_full_log if  year > 1984 &   potentialbeneficiary== 1, cluster(ccode)
eststo m2
ologit actions_O cirilagn totalimportslog  unemploymentlagged unipdiff pres_party dem_cong gdppcllog_full pop_full_log if  year > 1984 &   potentialbeneficiary== 1, cluster(ccode)
eststo m3
estout m1 m2 m3, cells(b(star fmt(3)) se(par fmt(2))) style(tex) starlevels(* 0.10 ** 0.05 *** .01)


**TABLE D (Models of Petition Acceptance)

logit petition_accepted cirilagn importcompetingimptslog unemploymentlagged unipdiff pres_party dem_cong gdppcllog_full pop_full_log if  year > 1984 &   currentbeneficiary== 1, cluster(ccode)
eststo m1
logit petition_accepted cirilagn totalimportslog unemploymentlagged unipdiff pres_party dem_cong gdppcllog_full pop_full_log if  year > 1984 &   currentbeneficiary== 1, cluster(ccode)
eststo m2
estout m1 m2, cells(b(star fmt(3)) se(par fmt(2))) style(tex) starlevels(* 0.10 ** 0.05 *** .01)


**TABLE E  (Heckman Probit Models - modelling beneficiary status)

heckprob  petition_accepted cirilagn importcompetingimptslog unemploymentlagged unipdiff pres_party dem_cong pop_full_log if year > 1984, select(currentbeneficiary =  cirilagn importcompetingimptslog unemploymentlagged unipdiff pres_party dem_cong gdppcllog_full pop_full_log) cluster(ccode)
eststo m1
heckprob  sanc_review cirilagn importcompetingimptslog unemploymentlagged unipdiff pres_party dem_cong pop_full_log if year > 1984, select(currentbeneficiary =  cirilagn importcompetingimptslog unemploymentlagged unipdiff pres_party dem_cong gdppcllog_full pop_full_log) cluster(ccode)
eststo m2
heckprob  sanc_suspend cirilagn importcompetingimptslog unemploymentlagged unipdiff pres_party dem_cong pop_full_log if year > 1984, select(currentbeneficiary =  cirilagn importcompetingimptslog unemploymentlagged unipdiff pres_party dem_cong gdppcllog_full pop_full_log) cluster(ccode)
eststo m3
estout m1 m2 m3, cells(b(star fmt(3)) se(par fmt(2))) style(tex) starlevels(* 0.10 ** 0.05 *** .01)


**Table F  (Heckman Probit Models - modelling petition filing)

heckprob  petition_accepted cirilagn importcompetingimptslog unemploymentlagged unipdiff pres_party dem_cong gdppcllog_full pop_full_log if year > 1984, select(pet_last3yrs=  cirilagn importcompetingimptslog unemploymentlagged unipdiff pres_party dem_cong gdppcllog_full  pop_full_log latam) cluster(ccode)
eststo m1
heckprob sanc_review cirilagn importcompetingimptslog unemploymentlagged unipdiff pres_party dem_cong gdppcllog_full pop_full_log if year > 1984, select(pet_last3yrs= cirilagn importcompetingimptslog unemploymentlagged unipdiff pres_party dem_cong gdppcllog_full pop_full_log latam) cluster(ccode)
eststo m2
heckprob  sanc_suspend cirilagn importcompetingimptslog unemploymentlagged unipdiff pres_party dem_cong gdppcllog_full pop_full_log if year > 1984, select(pet_last3yrs=  cirilagn importcompetingimptslog unemploymentlagged unipdiff pres_party dem_cong gdppcllog_full pop_full_log latam) cluster(ccode)
eststo m3
estout m1 m2 m3, cells(b(star fmt(3)) se(par fmt(2))) style(tex) starlevels(* 0.10 ** 0.05 *** .01)


**TABLE G (alternate worker rights variables: polity/PTS)

logit sanc_review  mosleyunon importcompetingimptslog unemploymentlagged unipdiff pres_party dem_cong gdppcllog_full pop_full_log if  year > 1984 &   currentbeneficiary== 1, cluster(ccode)
eststo m1
logit sanc_review  pts_stdpt importcompetingimptslog unemploymentlagged unipdiff pres_party dem_cong gdppcllog_full pop_full_log if  year > 1984 &   currentbeneficiary== 1, cluster(ccode)
eststo m2
logit sanc_review  polity importcompetingimptslog unemploymentlagged unipdiff pres_party dem_cong gdppcllog_full pop_full_log if  year > 1984 &   currentbeneficiary== 1, cluster(ccode)
eststo m3
logit sanc_suspend mosleyunon importcompetingimptslog unemploymentlagged unipdiff pres_party dem_cong gdppcllog_full pop_full_log if  year > 1984 &   potentialbeneficiary== 1, cluster(ccode)
eststo m4
logit sanc_suspend pts_stdpt importcompetingimptslog unemploymentlagged unipdiff pres_party dem_cong gdppcllog_full pop_full_log if  year > 1984 &   potentialbeneficiary== 1, cluster(ccode)
eststo m5
logit sanc_suspend polity importcompetingimptslog unemploymentlagged unipdiff pres_party dem_cong gdppcllog_full pop_full_log if  year > 1984 &   potentialbeneficiary== 1, cluster(ccode)
eststo m6
estout m1 m2 m3 m4 m5 m6, cells(b(star fmt(3)) se(par fmt(2))) style(tex) starlevels(* 0.10 ** 0.05 *** .01)



** TABLE H (Model 1 with various respecifications)

xtset ccode year
* logit with random effects
xtlogit sanc_review cirilagn importcompetingimptslog unemploymentlagged unipdiff pres_party dem_cong gdppcllog_full pop_full_log if  year > 1984 &   currentbeneficiary== 1 
eststo m1
*multilevel mixed effects ordered logit
melogit sanc_review cirilagn importcompetingimptslog  unemploymentlagged unipdiff pres_party dem_cong gdppcllog_full pop_full_log if  year > 1984 &   currentbeneficiary== 1
eststo m2
*add year dummies
tab year, gen(YEAR)
logit sanc_review cirilagn importcompetingimptslog unemploymentlagged unipdiff pres_party dem_cong gdppcllog_full pop_full_log YEAR* if  year > 1984 &   currentbeneficiary== 1, cluster(ccode)
eststo m3
*bootrap SE on country cluster
logit sanc_review cirilagn importcompetingimptslog  unemploymentlagged unipdiff pres_party dem_cong gdppcllog_full pop_full_log if  year > 1984 &   currentbeneficiary== 1, vce(bootstrap, reps(250) cluster(ccode) idcluster(newccode) group(ccode) seed(12345))
eststo m4
estout m1 m2 m3 m4, cells(b(star fmt(3)) se(par fmt(2))) style(tex) starlevels(* 0.10 ** 0.05 *** .01)



** TABLE I (Model 2 with various respecifications)

* logit with random effects
xtlogit sanc_suspend cirilagn importcompetingimptslog unemploymentlagged unipdiff pres_party dem_cong gdppcllog_full pop_full_log if  year > 1984 &   potentialbeneficiary== 1 
eststo m1
*multilevel mixed effects ordered logit
melogit sanc_suspend cirilagn importcompetingimptslog unemploymentlagged unipdiff pres_party dem_cong gdppcllog_full pop_full_log if  year > 1984 &   potentialbeneficiary== 1
eststo m2
*add year dummies
tab year, gen(YEAR)
logit sanc_suspend cirilagn importcompetingimptslog  unemploymentlagged unipdiff pres_party dem_cong gdppcllog_full pop_full_log YEAR* if  year > 1984 &   potentialbeneficiary== 1, cluster(ccode)
eststo m3
*bootrap SE on country cluster
logit sanc_suspend cirilagn importcompetingimptslog  unemploymentlagged unipdiff pres_party dem_cong gdppcllog_full pop_full_log if  year > 1984 &   potentialbeneficiary== 1, vce(bootstrap, reps(250) cluster(ccode) idcluster(newccode) group(ccode) seed(12345))
eststo m4
estout m1 m2 m3 m4, cells(b(star fmt(3)) se(par fmt(2))) style(tex) starlevels(* 0.10 ** 0.05 *** .01)



** TABLE J (Model 3 with various respecifications)

xtset ccode year
*ordered logit with random effects
xtologit actions_O cirilagn importcompetingimptslog unemploymentlagged unipdiff pres_party dem_cong gdppcllog_full pop_full_log if  year > 1984 &   potentialbeneficiary== 1
eststo m1
*multilevel mixed effects ordered logit
meologit actions_O cirilagn importcompetingimptslog  unemploymentlagged unipdiff pres_party dem_cong gdppcllog_full pop_full_log if  year > 1985 &   potentialbeneficiary== 1
eststo m2
*add year dummies
tab year, gen(YEAR)
ologit actions_O cirilagn importcompetingimptslog  unemploymentlagged unipdiff pres_party dem_cong gdppcllog_full pop_full_log YEAR* if  year > 1984 &   potentialbeneficiary== 1, cluster(ccode)
eststo m3
*bootrap SE on country cluster
ologit actions_O cirilagn importcompetingimptslog  unemploymentlagged unipdiff pres_party dem_cong gdppcllog_full pop_full_log if  year > 1984 &   potentialbeneficiary== 1, vce(bootstrap, reps(250) cluster(ccode) idcluster(newccode) group(ccode) seed(12345))
eststo m4
estout m1 m2 m3 m4, cells(b(star fmt(3)) se(par fmt(2))) style(tex) starlevels(* 0.10 ** 0.05 *** .01)


***************************
** TABLE K (CNL models omitting largest beneficiaries) 

reg  cnl_quant_log cirilagn importcompetingimptslog unemploymentlagged  gdppcllog_full pop_full_log unipdiff if ldbc == 0 & potentialbeneficiary == 1 & ccode != 750, cluster(ccode)
eststo m1
fitstat
reg  cnl_quant_log cirilagn importcompetingimptslog unemploymentlagged  gdppcllog_full pop_full_log unipdiff if ldbc == 0 & potentialbeneficiary == 1 & ccode != 160, cluster(ccode)
eststo m2
fitstat
reg  cnl_quant_log cirilagn importcompetingimptslog unemploymentlagged  gdppcllog_full pop_full_log unipdiff if ldbc == 0 & potentialbeneficiary == 1 & ccode != 140, cluster(ccode)
eststo m3
fitstat
estout m1 m2 m3, cells(b(star fmt(3)) se(par fmt(2))) style(tex) starlevels(* 0.10 ** 0.05 *** .01)


*********************TIME******************
** TABLE L (CNL models alternative time specification)

xtset ccode year
*RE
xtreg  cnl_quant_log cirilagn importcompetingimptslog unemploymentlagged gdppcllog_full pop_full_log unipdiff if ldbc == 0 & potentialbeneficiary == 1, cluster(ccode) re
eststo m1
*FE
xtreg  cnl_quant_log cirilagn importcompetingimptslog unemploymentlagged gdppcllog_full pop_full_log unipdiff if ldbc == 0 & potentialbeneficiary == 1, cluster(ccode) fe
eststo m2
*FE YEAR
tab year, gen(YEAR)
xtreg  cnl_quant_log cirilagn importcompetingimptslog unemploymentlagged gdppcllog_full pop_full_log unipdiff YEAR* if ldbc == 0 & potentialbeneficiary == 1, cluster(ccode)
eststo m3
*BS
xtreg  cnl_quant_log cirilagn importcompetingimptslog unemploymentlagged gdppcllog_full pop_full_log unipdiff if ldbc == 0 & potentialbeneficiary == 1, vce(bootstrap, reps(250)   group(ccode) seed(12345))
eststo m4
estout m1 m2 m3 m4, cells(b(star fmt(3)) se(par fmt(2))) style(tex) starlevels(* 0.10 ** 0.05 *** .01)

